package cn.itsource.rpms.service.impl;

import cn.itsource.rpms.mapper.BaseMapper;
import cn.itsource.rpms.service.IBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class BaseServiceImpl<T> implements IBaseService<T>{

    @Autowired
    private BaseMapper<T> mapper;

    @Override
    public List<T> queryAll() {
        return mapper.queryAll();
    }

    @Override
    public T queryOne(Serializable id) {
        return mapper.queryOne(id);
    }

    @Override
    @Transactional
    public void add(T t) {
        mapper.add(t);

    }

    @Override
    @Transactional
    public void update(T t) {
        mapper.update(t);
    }

    @Override
    @Transactional
    public void delete(Serializable id) {
        mapper.delete(id);
    }

    @Override
    @Transactional
    public void batchDelete(List ids) {
        mapper.batchDelete(ids);
    }
}
